auto resize an image to fit its div container